//
//  NGUtility.h
//  Mobil Izleme
//
//  Created by Mehmet Sinan Şahin on 1/2/12.
//  Copyright (c) 2012 netgis. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "NSString+Extensions.h"
#import "TTGlobalCoreLocale.h"

typedef enum NGLOC_LOG_TYPE 
{
    NGLOC_SENT = 1,
    NGLOC_UNSENT = 0,
    NGLOC_FORLOG = 3
} NGLOC_LOG_TYPE;

typedef enum MESSAGE_TYPE 
{
    COMMAND = 0,
    MESSAGE = 1,
    ALL = -99 //for query
} MESSAGE_TYPE;

typedef enum LOCAL_MESSAGE_TYPE 
{
    LOCAL_MESSAGE_TYPE_ALARM,
	LOCAL_MESSAGE_TYPE_TEXT
} LOCAL_MESSAGE_TYPE;

extern NSString * const TEST_DEVICE_ID;
extern NSString * const TEST_SERVER_URL;
extern NSString * const APP_SETTING_SEND_TO_SERVER;
extern NSString * const APP_SETTING_USE_GPS;
extern NSString * const APP_SETTING_SIGNIFICANT_LOCATION_UPDATE;
extern NSString * const APP_SETTING_LOCATION_SIZE;
extern NSString * const APP_SETTING_SEND_FREQUENCY;
extern NSString * const APP_SETTING_SERVICE_URL;
extern NSString * const APP_SETTING_DELTA_DISTANCE;
extern NSString * const APP_SETTING_TIME_INTERVAL;
extern NSString * const APP_SETTING_SESSION_ID;
extern NSString * const APP_SETTING_USERNAME;
extern NSString * const APP_SETTING_PASSWORD;
extern NSString * const APP_SETTING_DB_MODEL_VERSION;
extern NSString * const APP_SETTING_SERVICE_AGGREMENT;

extern NSString * const DATE_PATTERN;
extern NSString * const DATE_PATTERN_WITH_DOT;

extern NSString * const TIME_PATTERN;
extern int const MESSAGES_SIZE;
extern float const eV;
extern int const LAST_N_LOCATIONS_SIZE;
extern int const MAX_VALUES_TO_BE_DISPLAYED;


#define BEST_ACCURACY_ 1
#define BEST_ACCURACY_10M 50
#define NORMAL_ACCURACY 100
#define NEAR_ACCURACY_1KM 200
#define NEAR_ACCURACY_3KM 500


//extern NSString * const MINIMUM_DISTANCE_CHANGE_FOR_UPDATES;

@class NGLocation;
@class Command;

@interface NGUtility : NSObject

+(NSString *)getDeviceId;
+(void) setBadgeNumberForBackground;


+ (double) distanceWithLocation:(NGLocation *)from to:(NGLocation *)to;
+ (float) speed:(NGLocation *)from to:(NGLocation *)to;
+ (double) distance:(double)lat1 lon1:(double)lon1 lat2:(double)lat2 lon2:(double)lon2 unit:(char)unit;
+ (BOOL) isNotEmpty:(NSArray *) arr;

//sorts arr and returns new sorted array
+ (NSArray *) sort:(NSArray *)arr comparator:(id)comparator;
+ (UIImage *) imageForNGLocationStatus: (NGLocation *)location;
+ (UIImage *) imageForMessageType: (MESSAGE_TYPE) type;
+ (NSString *) friendlySpeed: (NGLocation *)location;
+ (NSString *) friendlyDate: (NSDate *)date;
+ (NSString *) friendlyStatus: (NGLocation *)location;
+ (NSString *) friendlyCommand: (Command *)command;

+ (void) alert: (NSString *)message title:(NSString *)title;
+ (void) alertError: (NSString *)message;
+ (void) alertForCannotAccessToURL: (NSString *)url;

+ (BOOL) handleRequestForError: (id) value showAlert:(BOOL)showAlert;

@end
